package com.effectiv.crm.config;

import java.util.concurrent.Executor;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;


@Configuration
@EnableAsync()
@ComponentScan(basePackages = { "com.effectiv.crm.service.impl", 
		"com.effectiv.crm.etl.impl"})
public class ServiceConfiguration implements AsyncConfigurer{

	public Executor getAsyncExecutor() {
		
		System.out.println("THREAD POOL");
		
		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(7);
        executor.setMaxPoolSize(42);
        executor.setQueueCapacity(11);
        executor.setThreadNamePrefix("MyExecutor-");
        executor.setBeanName("threadPoolTaskExecutor");
        executor.initialize();
        return executor;
	}

	
	
}
